package com.jwsoft.manager.core.gateway.controller;

import com.bifang.assistant.common.constants.Validators;
import com.bifang.engine.assistant.core.domain.AppResponse;
import com.bifang.engine.protect.core.annotation.Idempotent;
import com.github.pagehelper.PageInfo;
import com.jwsoft.manager.common.vo.eduZsbAbandon.EduZsbAbandonKeyVO;
import com.jwsoft.manager.common.vo.eduZsbAbandon.EduZsbAbandonQueryVO;
import com.jwsoft.manager.common.vo.eduZsbAbandon.EduZsbAbandonVO;
import com.jwsoft.manager.core.integration.EduZsbAbandonIntegration;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 放弃直升班管理网关
 *
 * @author chenzh
 * @since 2023-03-18
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "放弃直升班管理", description = "放弃直升班管理")
public class EduZsbAbandonController {

    @Autowired
    public EduZsbAbandonIntegration eduZsbAbandonIntegration;

    @Operation(summary = "放弃直升班管理分页查询",description = "放弃直升班管理分页查询")
    @PostMapping(value = "/zsbAbandon0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduZsbAbandonVO>> getList(@RequestBody @Validated EduZsbAbandonQueryVO vo) {
        return AppResponse.successData(eduZsbAbandonIntegration.getList(vo));
    }

    @Operation(summary = "放弃直升班管理根据主键查询详情",description = "放弃直升班管理根据主键查询详情")
    @PostMapping(value = "/zsbAbandon0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduZsbAbandonVO> getById(@RequestBody @Validated EduZsbAbandonKeyVO vo) {
        return AppResponse.successData(eduZsbAbandonIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "放弃直升班管理新增",description = "放弃直升班管理新增")
    @PostMapping(value = "/zsbAbandon0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduZsbAbandonVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduZsbAbandonVO vo) {
        return AppResponse.successData(eduZsbAbandonIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "放弃直升班管理修改",description = "放弃直升班管理修改")
    @PostMapping(value = "/zsbAbandon0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduZsbAbandonVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduZsbAbandonVO vo) {
        return AppResponse.successData(eduZsbAbandonIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "放弃直升班管理删除",description = "放弃直升班管理删除")
    @PostMapping(value = "/zsbAbandon0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduZsbAbandonKeyVO vo) {
        eduZsbAbandonIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }
}
